﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TETRIS_v01.GameHost
{
    public class InputHandler: InputHandlerBase
    {
        /*public event EventHandler MoveRight;
        public event EventHandler MoveLeft;
        public event EventHandler MoveDown;*/

        public override void QueryKeyBoard()
        {
            if (Console.KeyAvailable)
            {
                ConsoleKeyInfo kInfo = Console.ReadKey(true);

                switch (kInfo.Key)
                {
                    case ConsoleKey.RightArrow :
                        OnMoveRight();
                        break;
                    case ConsoleKey.LeftArrow :
                        OnMoveLeft();
                        break;
                    case ConsoleKey.DownArrow:
                        OnMoveDown();
                        break;
                    case ConsoleKey.UpArrow:
                        OnRotate();
                        break;
                }
            }
        }

        /*protected virtual void OnMoveRight()
        {
            if (this.MoveRight != null)
                this.MoveRight(this, EventArgs.Empty);
        }

        protected virtual void OnMoveLeft()
        {
            if (this.MoveLeft != null)
                this.MoveLeft (this, EventArgs.Empty);
        }

        protected virtual void OnMoveDown()
        {
            if (this.MoveDown != null)
                this.MoveDown(this, EventArgs.Empty);
        }*/
    }
}
